﻿<%@ Page Title="" Language="C#" MasterPageFile="~/layout/admin.Master" AutoEventWireup="true" CodeBehind="CentralBarOrder.aspx.cs" Inherits="SinhNhat.admin.slider.CentralBarOrder" %>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentMain" runat="server">
<script type="text/javascript" src="/public/js/jquery.ui.widget.min.js"></script>
<script type="text/javascript" src="/public/js/jquery.ui.sortable.min.js"></script>
<script type="text/javascript" src="/public/js/jquery.ui.mouse.min.js"></script>
<script type="text/javascript" src="/public/js/jquery.ui.core.min.js"></script>
<style>
    .ui-state-default { border: 1px solid #d3d3d3/*{borderColorDefault}*/; background: #e6e6e6/*{bgColorDefault}*/ url(images/ui-bg_glass_75_e6e6e6_1x400.png)/*{bgImgUrlDefault}*/ 50%/*{bgDefaultXPos}*/ 50%/*{bgDefaultYPos}*/ repeat-x/*{bgDefaultRepeat}*/; font-weight: normal/*{fwDefault}*/; color: #555555/*{fcDefault}*/; }
    #sortable { list-style-type: none; margin: 0; padding: 0; width: 60%; }
	#sortable div { margin: 0 3px 3px 3px; padding: 0.4em; padding-left: 1.5em; font-size: 1.4em; height: 18px; }
</style>

<script type="text/javascript">
    $(function () {
        $("#sortable").sortable({ items: 'div' });
        $("#sortable").disableSelection();

        function OnSucceeded(res) {
            // Display "thank you."
            alert("Success! Let Continue.");
        }

        function OnFailed(error) {
            // Alert user to the error.
            alert(error.get_message());
        }

        $("#btnSave").click(function () {
            var result = $('#sortable').sortable('toArray');
            PageMethods.Save(result, OnSucceeded, OnFailed);
        });

    });
</script>


    <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true">
    </asp:ScriptManager>
    <div class="box grid_8 round_all">
		    <h2 class="box_head grad_colour">Sắp xếp Thứ Tự Các Banner Trung Tâm</h2>
		    <div class="toggle_container">
			    <div class="block">

                <asp:Repeater ID="LstSortable" runat="server" DataSourceID="CentralBarDataSource">
                    <HeaderTemplate>
                        <ul id="sortable">
                
                    </HeaderTemplate>
                    <ItemTemplate>
                        <div class="ui-state-default" id=<%#Eval("IdCentralBar") %>>
                            <%#Eval("Name") %>
                        </div>
                    </ItemTemplate>
                    <FooterTemplate>
                        </ul>
                    </FooterTemplate>
                </asp:Repeater>

    

                <asp:LinqDataSource ID="CentralBarDataSource" runat="server" 
                    ContextTypeName="DAL.SinhNhatDBDataContext" EntityTypeName="" 
                    TableName="CENTRALBARs" Where="Status == @Status" OrderBy="Position">
                    <WhereParameters>
                        <asp:Parameter DefaultValue="true" Name="Status" Type="Boolean" />
                    </WhereParameters>
        
                </asp:LinqDataSource>

    

            </div>

        </div>
    </div>

    <input id="btnSave" class="button_colour round_all" style="height:30px;" type="button" value="Lưu Kết Quả" />
</asp:Content>
